<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang='en'>
<head>
	<meta charset='utf-8' />
	<title>杰购电子</title>
	<meta content='' name='description' />
	<meta content='' name='author' />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- Bootstrap -->
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" media="screen">
	<link href="__PUBLIC__/css/font-awesome.min.css" rel="stylesheet" >
	
	<!--[if IE 7]>
	<link  href="__PUBLIC__/css/font-awesome-ie7.min.css" rel="stylesheet">
	<![endif]-->

	<link href="__PUBLIC__/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="__PUBLIC__/css/test.css" rel="stylesheet">
	<script src="__PUBLIC__/js/jquery.js"></script>
	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	<script src="__PUBLIC__/js/html5shiv.js"></script>
	<script src="__PUBLIC__/js/respond.min.js"></script>
	<![endif]-->
</head>
<body>
	<div class="shade"></div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span9 content">

<script type="text/javascript">
	var manager = null;
	function add() {
		pid = $("#id").val();
		$("#form_data :input :not(:button)").each(function() {
			$(this).val("");
		});
		$("#form_data :text").each(function() {
			$(this).val("");
		});
		$("#pid").val(pid);
		$("#id").val('');
		$("#opmode").val("add");
	};

	function save() {
		icon_path = "__PUBLIC__/images/system_icon/";
		ico = $("#icon").val();
		if (ico.length > 0) {
			$("#icon").val(icon_path + $("#icon").val());
		}
		sendForm("form_data", "<?php echo U('node/save');?>&<?php echo U('node/index');?>&s_pid=" + $("#s_pid").val());
	};
	function test() {
		form_search.submit();
	};
	function select_pid() {
		winopen("<?php echo U('winpop');?>", 800, 800);
	}

	function showdata(result) {
		for (var s in result.data) {
			if (($("#" + s).attr("type")) === "select-one") {
				$("#" + s + " option[value='" + result.data[s] + "']").attr("selected", "selected");
			} else {
				$("#" + s).val(result.data[s]);
			}
		}
		$("#node_name").val($("#node_list option[value='" + $("#pid").val() + "']").text());
		$("#opmode").val("edit");
	}

	$(document).ready(function() {
		$(".sub_left_menu .tree_menu a").click(function() {
			$(".sub_left_menu .tree_menu  a").each(function() {
				$(this).attr("class", "");
			});
			$(this).attr("class","active");
			sendAjax("<?php echo U('ajaxRead');?>", "id=" + $(this).attr("node"), function(data) {
				showdata(data);
			});
			return false;
		})
		sendAjax("<?php echo U('ajaxRead');?>", "id=<?php echo ($pid); ?>", function(data) {
			showdata(data);
		});
	});

</script>
<div class="admin" >
	<div class="row-fluid title">
		<span>节点管理</span>
	</div>
	<form name="form_search" method="post" action="">
		<div class="row-fluid operate" >
			<div class="left">
				<select id="s_pid" name="s_pid" onchange="test()" ondblclick="" class="" ><?php  foreach($groupList as $key=>$val) { if(!empty($pid) && ($pid == $key || in_array($key,$pid))) { ?><option selected="selected" value="<?php echo $key ?>"><?php echo $val ?></option><?php }else { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } } ?></select>
			</div>
			<div class="right">
				<a onclick="add();" class="btn">新增</a>
				<a onclick="save();"  class="btn">保存</a>
			</div>
		</div>
	</form>
	<!-- 功能操作区域结束 -->
	<!-- 列表显示区域  -->
	<div class="row-fluid">
		<div class="span4 sub_left_menu">
			<div class="wrap">
				<?php echo $menu ?></div>
		</div>
		<div class="span8 sub_content">
			<form id="form_data" name="form_data" method="post" action="">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="pid" id="pid" value="<?php echo ($pid); ?>">
				<input type="hidden" name="ajax" id="ajax" value="1">
				<input type="hidden" name="opmode" id="opmode" value="">
				<select id="node_list" name="node_list" onchange="" ondblclick="" class="dis" ><?php  foreach($node_list as $key=>$val) { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } ?></select>
				<div id="edit" class="" >
					<table class="table table-bordered">
						<tr>
							<th>名称</th>
							<td>
								<input type="text" id="name" name="name"></td>
						</tr>
						<tr>
							<th>地址</th>
							<td>
								<input type="text" id="url" name="url"></td>
						</tr>
						<tr>
							<th>
								<nobr>父节点</nobr>
							</th>
							<td>
								<input type="text" id="node_name" name="node_name" readonly>
								<input class="wd2 btn" type="button" value="选择父节点" onclick="select_pid();"></td>
						</tr>
						<tr>
							<th>图标</th>
							<td>
								<input type="text" id="icon" name="icon"></td>
						</tr>
						<tr>
							<th>子文件夹</th>
							<td>
								<input type="text" id="sub_folder" name="sub_folder" value=""></td>
						</tr>
						<tr>
							<th>排序</th>
							<td>
								<input type="text" id="sort" name="sort"></td>
						</tr>
						<tr>
							<th>核对权限</th>
							<td>
								<select class=""  name="check_auth" id="check_auth">
									<option  value="1">启用</option>
									<option value="0">禁用</option>
								</select>
							</td>
						</tr>
						<tr>
							<th>状态</th>
							<td>
								<select class=""  name="status" id="status">
									<option  value="1">启用</option>
									<option value="0">禁用</option>
								</select>
							</td>
						</tr>
						<tr>
							<th>备注</th>
							<td>
								<textarea id="remark" name="remark" rows="" cols=""></textarea>
							</td>
						</tr>
					</table>
				</div>
			</form>
		</div>
	</div></div>
		</div>
	</div>
	<div class="msg popout">
	</div>
	<!--<iframe src="<?php echo U('/push/client');?>" class="push" id="push"></iframe>-->
	<script src="__PUBLIC__/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/js/common.js"></script>
	<script src="__PUBLIC__/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script> 
     <link href="__PUBLIC__/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
	<script type="text/javascript" src="http://tajs.qq.com/stats?sId=20624928" charset="UTF-8"></script>
</body>
</html>